<!--
 * @Description: 
 * @Author: 胡涛
 * @Date: 2023-09-13 21:16:35
 * @LastEditors: 胡涛
 * @LastEditTime: 2023-11-10 23:06:13
-->
<template>
  <a-select
    :options="options"
    :value="value"
    @change="onValueChanged"
    v-bind="$props"
  >
  </a-select>
</template>

<script lang="ts" setup>
import { computed } from "vue";
import { dictionaryOptions } from "@/plugins/dictionary";

const emits = defineEmits(["update:value", "change"]);

const props = defineProps({
  value: {
    type: [String, Number],
  },
  name: { type: String, required: true },
});

const options = computed(() => {
  return dictionaryOptions(props.name);
});

const onValueChanged = (value: string) => {
  emits("update:value", value);
  emits("change", value);
};
</script>

<style lang="less" scoped></style>
